package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.Advert;
import com.zhongxiangspace.entity.AdvertSite;
import com.zhongxiangspace.entity.QueryAnalyzer;
import com.zhongxiangspace.mapper.AdvertMapper;
import com.zhongxiangspace.service.AdvertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 广告
 */
@Service
public class AdvertServiceImpl implements AdvertService {

    @Autowired
    private AdvertMapper advertMapper;
    /**
     * 广告位置
     * @return
     */
    @Override
    public List<AdvertSite> queryAllAdvertSite() {
        return this.advertMapper.queryAllAdvertSite();
    }

    /**
     * 插入广告
     * @param advert
     * @return
     */
    @Override
    public boolean insert(Advert advert) {
        return this.advertMapper.insert(advert);
    }

    /**
     *  查询广告
     * @param queryAnalyzer 条件
     * @return
     */
    @Override
    public  List<Map<String,Object>> queryAdvert(QueryAnalyzer queryAnalyzer) {
        return this.advertMapper.queryAdvert(queryAnalyzer);
    }

    /**
     * 查询单条
     * @param id
     * @return
     */
    @Override
    public Advert queryOne(Integer id) {
        return this.advertMapper.queryOne(id);
    }

    /**
     * 更新上下线
     * @param advert
     * @return
     */
    @Override
    public boolean updataStatusCode(Advert advert) {
        return this.advertMapper.updataStatusCode(advert);
    }

    /**
     * 逻辑删除
     * @param id
     * @return
     */
    @Override
    public boolean delete(Integer id) {
        return this.advertMapper.delete(id);
    }

    /**
     *  更新广告
     * @param advert
     * @return
     */
    @Override
    public boolean updata(Advert advert) {
        return this.advertMapper.updata(advert);
    }
}
